.cost
  - computation = product_parameter.cost_amount_computation(nature: nature)
  .computation
    - if computation.failed?
      = 'FAILED'
    - elsif computation.none?
      = '&mdash;'.html_safe
    - elsif computation.quantity?
      %span.quantity= computation.quantity.round(3).l(precision: 0)
      %span.unit-name= computation.unit_name
      %span x
      - if computation.sale?
        = link_to(computation.human_unit_amount, {controller: :sales, action: :show, id: computation.sale.id})
      - elsif computation.purchase?
        = link_to(computation.human_unit_amount, {controller: :purchases, action: :show, id: computation.purchase.id})
      - elsif computation.catalog?
        - if computation.catalog_item
          = link_to(computation.human_unit_amount, {controller: :catalog_items, action: :edit, id: computation.catalog_item.id, redirect: request.fullpath})
        - else
          = link_to(:add_catalog_price.tl, {controller: :catalog_items, action: :new, variant_id: product_parameter.product.variant.id, catalog_id: Catalog.by_default!(computation.catalog_usage).id, redirect: request.fullpath})
      %span =
      - if computation.amount?
        %span.amount= computation.human_amount
      - else
        %span.amount.no-amount
          %i.icon.icon-question

  - if computation.quantity?
    .origin
      - if computation.sale?
        = :amount_computed_from.th(source: link_to(computation.sale.number, {controller: :sales, action: :show, id: computation.sale.id}, title: Sale.model_name.human))
      - elsif computation.purchase?
        = :amount_computed_from.th(source: link_to(computation.purchase.number, {controller: :purchases, action: :show, id: computation.purchase.id}, title: Purchase.model_name.human))
      - elsif computation.catalog? && computation.catalog_item && computation.catalog
        = :amount_estimated_from.th(source: link_to(computation.catalog.name, {controller: :catalogs, action: :show, id: computation.catalog.id}, title: Catalog.model_name.human))
